import { mapGetters, mapMutations, mapActions } from 'vuex'
import SkinColor from '@/assets/skin/index.js'
const appMixin = {
	computed: {
		app () {
			return getApp().globalData
		},
		skinMode () {
			return this.$store.getters['setting/GET_SKIN_MODE']
		},
		skinColor () {
			return SkinColor[this.skinMode]
		},
		bottomPopupHeight () {
			return this.windowHeight * (2 / 3)
		},
		$Router () {
			return getApp().globalData.$Router
		},
		$Route () {
			return getApp().globalData.$Route
		},
		$utils () {
			return getApp().globalData.$utils
		},
		$native () {
			return getApp().globalData.$native
		}
	},
	data () {
		return {
			windowWidth: 0,
			windowHeight: 0,
			windowTop: 0,
			windowBottom: 0
		}
	},
	onShow () {
		this._hidePlayer()
	},
	created () {
		const system = uni.getSystemInfoSync()
		this.windowTop = system.safeArea.top
		this.windowBottom = system.safeAreaInsets.bottom
		this.windowWidth = system.windowWidth
		this.windowHeight = system.windowHeight
	},
	methods: {
		//展示视频播放器
		_hidePlayer () {
			const player = plus.webview.getWebviewById('videoplayer')
			const pages = getCurrentPages()
			const page = pages[pages.length - 1]
			if ( page.route != 'pages/find/index' && player ) player.hide()
		}
	}
}

export default appMixin;